/**
 * 
 */
package toutiao;

import java.util.Scanner;

/**给定整数m以及n各数字A1,A2,..An，将数列A中所有元素两两异或，共能得到n(n-1)/2个结果，请求出这些结果中大于m的有多少个
 * @author zhongfang
 *
 */
public class 异或 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		int m=scanner.nextInt();
		int a[]=new int[n];
//		String[] strings=new String[n];
		for (int i = 0; i < n; i++) {
			a[i]=scanner.nextInt();
//			strings[i]=Integer.toBinaryString(a[i]);
		}
		int res=0;
		for (int i = 0; i < n; i++) {
			for (int j = i+1; j < n; j++) {
				if((a[i]^a[j])>m){
					res++;
				}
			}
		}
		System.out.println(res);
	}

}
